package com.jhw.exception;

import lombok.Data;

/**
 * @author jhw
 * @create 2022/9/24
 */
@Data
public class GlobalCustomException extends RuntimeException{
    // 异常信息
    private String errorMessage;

    // 异常码
    private String errorCode;

    public GlobalCustomException(){
        super();
    }

    public GlobalCustomException(String errorMessage, String errorCode) {
        super(errorMessage);
        this.errorMessage = errorMessage;
        this.errorCode = errorCode;
    }

    public GlobalCustomException(String errorMessage) {
        super(errorMessage);
        this.errorMessage = errorMessage;
    }

    public GlobalCustomException(GlobalErrorCode globalErrorCode) {
        super(globalErrorCode.getMessage());
        this.errorMessage = errorMessage;
        this.errorCode = errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }
}
